#-------------------------------------------------
#
# Project created by QtCreator 2015-08-01T00:00:11
#
#-------------------------------------------------

PRO_ROOT = $$PWD/../..

QT     -= core gui
CONFIG -= app_bundle
CONFIG -= qt
CONFIG += console
TEMPLATE = app

win32 {
    TARGET = $$qtLibraryTarget(test_simd)
} else {
    TARGET = test_simd
}

DESTDIR = $${PRO_ROOT}/bin

# - output - tmp -
macx: {
    J_PLAT_PREFIX = macx
} else: unix {
    J_PLAT_PREFIX = unix
}

PRO_TEMP_PREFIX = $${PRO_ROOT}/temp/examples/tools/$${J_PLAT_PREFIX}
macx:unix: {
    MOC_DIR = $${PRO_TEMP_PREFIX}
    OBJECTS_DIR = $${PRO_TEMP_PREFIX}
    RCC_DIR = $${PRO_TEMP_PREFIX}
}

## -

unix: {
    QMAKE_CXXFLAGS += -mmmx -msse
}

## - import libraries -

# jsimd

win32:CONFIG(release, debug|release): LIBS += -L$${PRO_ROOT}/lib/jsimd -ljsimd
else:win32:CONFIG(debug, debug|release): LIBS += -L$${PRO_ROOT}/lib/jsimd -ljsimdd
else:macx: LIBS += -framework jsimd -F$${FRAMEWORK_ROOT}/lib/
else:unix: LIBS += -L$${PRO_ROOT}/lib/jsimd -ljsimd

macx:{
    INCLUDEPATH += $${PRO_ROOT}/lib/jsimd.framework/Versions/Current/Headers
    DEPENDPATH += $${PRO_ROOT}/lib/jsimd.framework/Versions/Current/Headers
} else {
    INCLUDEPATH += $${PRO_ROOT}/lib/jsimd/include
    DEPENDPATH += $${PRO_ROOT}/lib/jsimd/include
}

## copy libraries

copyCommand = @echo ---- module $${TARGET}: copy libraries ----

## lib-suffix
win32:CONFIG(debug, debug|release):lib_suffix=d

destdir = $${PRO_ROOT}/bin
srcfiles =
macx: {
    ##
} else:win32: {
    destdir = $$replace(destdir, /, \\)
    # jsimd
    srcfiles += $${PRO_ROOT}/lib/jsimd/jsimd$${lib_suffix}.dll
    ## copy files
    exists("$$srcfiles"): {
        srcfiles = $$replace(srcfiles, /, \\)
        copyCommand += && copy "$$srcfiles" "$$destdir"
    }
} else:unix: {
    # jsimd
    srcfiles += $${PRO_ROOT}/lib/jsimd/libjsimd$${lib_suffix}.so*
    ## copy files
    exists("$$srcfiles"):copyCommand += && $(COPY) "$$srcfiles" "$$destdir"

    ##
    LIBS += -lrt
}

first.depends = $(first)
jsimd.commands = $$copyCommand
first.depends += jsimd

QMAKE_EXTRA_TARGETS += first \
    jsimd

##

HEADERS += \
    test_simd.h

SOURCES += \
    test_simd.cpp \
    main.cpp

INCLUDEPATH += $$PWD/../common
